﻿using System;
using System.ComponentModel.DataAnnotations;

namespace W2R.Core.Models
{
    /// <summary>
    /// Base entity for all entities model
    /// </summary>
    /// <typeparam name="TId"></typeparam>
    public abstract class BaseEntity<TId>
        where TId : struct
    {
        #region Constructor

        public BaseEntity()
        {
            this.Id = default(TId);
        }

        #endregion

        /// <summary>
        /// Identifier for an entity
        /// </summary>
        [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public TId Id { get; set; }

        /// <summary>
        /// Identifies the state of this entity
        /// </summary>
        [Required]
        public bool Active { get; set; }

        /// <summary>
        /// Identifies who create this entity
        /// </summary>
        [Required]
        public string CreatedBy { get; set; }

        /// <summary>
        /// Identifies when was this entity created
        /// </summary>
        [Required]
        public DateTimeOffset CreatedOn { get; set; }

    }
}
